package com.zbkj.admin.task.brokerage;


import com.zbkj.admin.task.order.OrderReceiptTask;
import com.zbkj.common.utils.CrmebDateUtil;
import com.zbkj.service.service.CommunityStatService;
import com.zbkj.service.service.UserBrokerageRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 小区分红统计task
 +----------------------------------------------------------------------
 */
@Component("CommunityBrokerageTask")
public class CommunityBrokerageTask {

    //日志
    private static final Logger logger = LoggerFactory.getLogger(OrderReceiptTask.class);

    @Autowired
    private UserBrokerageRecordService userBrokerageRecordService;

    @Autowired
    private CommunityStatService communityStatService;

    /**
     * 每题凌晨1点统计一次
     */
    public void communityBrokerage() {
        // cron : 0 0 */1 * * ?
        logger.info("---CommunityBrokerageTask task------produce Data with fixed rate task: Execution Time - {}", CrmebDateUtil.nowDateTime());
        try {
            communityStatService.communityBrokerageTask();
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("CommunityBrokerageTask.task" + " | msg : " + e.getMessage());
        }
    }
}
